package cn.wolfcode.mapper;

import cn.wolfcode.domain.Role;
import cn.wolfcode.qo.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Role record);

    Role selectByPrimaryKey(Long id);

    List<Role> selectAll();

    int updateByPrimaryKey(Role record);

    //分页查询
    List<Role> queryPage(QueryObject qo);

    //根据员工id去中间表找对应角色id,再去角色表找角色对象
    List<Role> queryByEmpId(Long id);

    //删除角色和员工的中间表关系
    void deleteRelationWithEmployee(Long roleId);

    //删除角色权限中间表关系
    void deleteRelation(Long roleId);

    //保存角色与权限的关系
    void saveRelation(@Param("roleId") Long roleId, @Param("permissionIds") Long[] permissionIds);
}